//
//  LLTabBarController.m
//  Happy to chat
//
//  Created by LL on 15/12/5.
//  Copyright © 2015年 LL. All rights reserved.
//

#import "LLTabBarController.h"

@interface LLTabBarController ()

@end
/**
 *  
 */
@implementation LLTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
     // 1. 添加自控制器
    [self addChildControllers];
    
    //修改底部的颜色
    self.tabBar.barTintColor = [UIColor colorWithRed:89/255.0 green:156/255.0 blue:207/255.0 alpha:0.7];
    self.tabBar.tintColor = [UIColor blackColor];

}

/**
 *  加载自控制器
 */
- (void)addChildControllers{
    int i = 0;
    int a = 0;
    // 1.1 记载自控制器
    NSArray *array = @[@"Entertainment",@"Messages",@"Friends",@"User"];
//    NSArray *array = @[@"Entertainment",@"Friends",@"User"];
    
    //修改底部的文字
    NSArray *array1 = @[@"视频",@"攻略",@"笑图",@"我"];
    
    //修改底部的图片

    NSArray *array2 = @[@"tabbar_icon_news_highlight",@"tabbar_icon_found_highlight@2x",@"tabbar_icon_reader_highlight@2x",@"tabbar_icon_me_highlight@2x"];
    
    // 1.2 得到SB
    
    //盛放子控制器
//    NSMutableArray *arrayM = [NSMutableArray array];
    
    for (NSString *sbName in array) {
        
        UIStoryboard *sb = [UIStoryboard storyboardWithName:sbName bundle:nil];
        
        UINavigationController *narVC = [sb instantiateInitialViewController];
        
//        [arrayM addObject:narVC];
        [self addChildViewController:narVC];
        
        narVC.tabBarItem.title = array1[i++];
        
        
        narVC.tabBarItem.image =[[UIImage imageNamed:array2[a++]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        
    }
   

    
}













@end
